/**
 * Licensee: Universidad de Almeria
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateAgendaRMI2Data {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm.AgendaRMI2PersistentManager.instance().getSession().beginTransaction();
		try {
			orm.Registro lormRegistro = orm.RegistroDAO.loadRegistroByQuery(null, null);
			// Update the properties of the persistent object
			orm.RegistroDAO.save(lormRegistro);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Registro by RegistroCriteria");
		orm.RegistroCriteria registroCriteria = new orm.RegistroCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//registroCriteria.telefono.eq();
		System.out.println(registroCriteria.uniqueRegistro());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateAgendaRMI2Data retrieveAndUpdateAgendaRMI2Data = new RetrieveAndUpdateAgendaRMI2Data();
			try {
				retrieveAndUpdateAgendaRMI2Data.retrieveAndUpdateTestData();
				//retrieveAndUpdateAgendaRMI2Data.retrieveByCriteria();
			}
			finally {
				orm.AgendaRMI2PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
